<template>
  <el-card shadow="never" class="aui-card--fill">
    <div class="mod-eightapp__eimanagerinfo}">
      <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
        <el-form-item>
          <el-input v-model="dataForm.id" placeholder="id" clearable></el-input>
        </el-form-item>
        <el-form-item>
          <el-button @click="getDataList()" icon="el-icon-search"></el-button>
        </el-form-item>
        <el-form-item>
          <el-button type="success" @click="exportHandle()">{{ $t('export') }}</el-button>
        </el-form-item>
        <el-form-item>
          <el-button v-if="$hasPermission('eightapp:eimanagerinfo:save')" type="primary" icon="el-icon-plus" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button>
        </el-form-item>
        <el-form-item>
          <el-button v-if="$hasPermission('eightapp:eimanagerinfo:delete')" type="danger" icon="el-icon-delete" @click="deleteHandle()">{{ $t('deleteBatch') }}</el-button>
        </el-form-item>
      </el-form>
      <el-table v-loading="dataListLoading" :data="dataList" border @selection-change="dataListSelectionChangeHandle" style="width: 100%;">
        <el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
        <el-table-column prop="id" label="物业管理员编号" header-align="center" align="center"></el-table-column>
        <el-table-column prop="name" label="姓名" header-align="center" align="center"></el-table-column>
        <el-table-column prop="sex" label="性别" header-align="center" align="center" :formatter="sexFormatter"></el-table-column>
        <el-table-column prop="birthday" label="出生日期" header-align="center" align="center"></el-table-column>
        <el-table-column prop="tel" label="联系方式" header-align="center" align="center"></el-table-column>
        <el-table-column prop="adminId" label="系统管理员编号" header-align="center" align="center"></el-table-column>
        <el-table-column prop="creator" label="建表人" header-align="center" align="center"></el-table-column>
        <el-table-column prop="createTime" label="建表时间" header-align="center" align="center"></el-table-column>
        <el-table-column prop="updator" label="更新人" header-align="center" align="center"></el-table-column>
        <el-table-column prop="updateTime" label="更新时间" header-align="center" align="center"></el-table-column>
        <el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="250">
          <template slot-scope="scope">
            <el-button v-if="$hasPermission('eightapp:eimanagerinfo:update')" size="small" @click="addOrUpdateHandle(scope.row.id)" type="primary" icon="el-icon-edit" circle></el-button>
            <el-button v-if="$hasPermission('eightapp:eimanagerinfo:delete')" size="small" @click="deleteHandle(scope.row.id)" type="danger" icon="el-icon-delete" circle></el-button>
          </template>
        </el-table-column>
      </el-table>
      <el-pagination
        :current-page="page"
        :page-sizes="[10, 20, 50, 100]"
        :page-size="limit"
        :total="total"
        layout="total, sizes, prev, pager, next, jumper"
        @size-change="pageSizeChangeHandle"
        @current-change="pageCurrentChangeHandle">
      </el-pagination>
      <!-- 弹窗, 新增 / 修改 -->
      <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
    </div>
  </el-card>
</template>

<script>
import mixinViewModule from '@/mixins/view-module'
import AddOrUpdate from './eimanagerinfo-add-or-update'
export default {
  mixins: [mixinViewModule],
  data () {
    return {
      mixinViewModuleOptions: {
        getDataListURL: '/eightapp/eimanagerinfo/page',
        getDataListIsPage: true,
        exportURL: '/eightapp/eimanagerinfo/export',
        deleteURL: '/eightapp/eimanagerinfo',
        deleteIsBatch: true
      },
      dataForm: {
        id: ''
      }
    }
  },
  components: {
    AddOrUpdate
  },
  methods:{
    sexFormatter(row) {
        var sex = row.sex
        if(sex == 0){
          return '女'
        }else if(sex == 1){
          return '男'
        }
      }
  }
}
</script>
